import { createApp } from 'vue'
import App from './App.vue'
import { Button, Icon, Form, Field, Skeleton, Swipe, SwipeItem } from 'vant' //引入组件
import { Tabs, Tab, PullRefresh, List, ActionBar, ActionBarIcon, ActionBarButton } from 'vant'
import { AddressEdit,  AddressList, CheckboxGroup, SwipeCell, Checkbox, Stepper, SubmitBar, Popup, Card } from 'vant'
import router from './router'
import store from './store'
// import 'vant/lib/index.css' //全局引入样式
import 'lib-flexible' //引入适配rem文件



const app = createApp(App) //生成实例
app.use(router) //注册路由
app.use(store) //注册store实例
app.use(Button) //全局注册Button组件
  .use(Icon)
  .use(Form)
  .use(Field)
  .use(Skeleton)
  .use(Swipe)
  .use(SwipeItem)
app.use(Tabs)
  .use(Tab)
  .use(PullRefresh)
  .use(List)
  .use(ActionBar)
  .use(ActionBarIcon)
  .use(ActionBarButton)
app.use(AddressEdit)
  .use(AddressList)
  .use(CheckboxGroup)
  .use(SwipeCell)
  .use(Checkbox)
  .use(Stepper)
  .use(SubmitBar)
  .use(Popup)
  .use(Card)

//全局过滤器
app.config.globalProperties.$filters = {
  prefix(url){
    if(url && url.startsWith('http')){
      return url
    }else{
      url = `http://backend-api-01.newbee.ltd${url}`
      return url
    }
  }
}

app.mount('#app') //挂载实例


